<?php
$operation = Blyn::app()->getActiveOperation();
//$operationUI = $operation->getUIManager();

$page = new BUIControl();
$page->setNode($operation);
//
$model = new JoinSpaceFormModel();
//$postJoinSpace = filter_input(INPUT_POST, 'JoinSpaceFormModel');
if (isset($_POST['JoinSpaceFormModel'])) {
//if ($postJoinSpace != NULL){
    $model->attributes = $_POST['JoinSpaceFormModel'];
    //$model->attributes = $postJoinSpace;
//$screen->renderView('leftMenu');
}

$screen = Blyn::app()->getCurrentNode()->getUIManager()->getCurrentScreen();
$searchStr = Yii::t('site', 'Search');
?>

<div class="row-fluid" style="margin-top: 15px">    
    <?php
            
                    /** @var BootActiveForm $form */ $spaceId = Blyn::app()->getUIManager()->getCurrentScreen()->getContextVariable('spaceId');
    if (!$screen->isAjaxLinkClicked('linkJoin')) {
        $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
            'id' => 'searchForm',
            'type' => 'search',
            'htmlOptions' => array('class' => 'well span12'),
        ));
        ?>
        <?php echo $form->textFieldRow($model, 'searchText', array('class' => 'input', 'prepend' => '<i class="icon-search"></i>')); ?>

        <?php
        $searchBtn = $screen->getAjaxLink($searchStr, array('htmlOptions' => array('class' => 'btn')));
        ?>
        <?php echo $searchBtn ?>
        <?php
        $this->endWidget();
    }
    ?>  
</div>

<div id="show_Space_list">
    <?php
    //$ajaxViews = array(array('ajaxView' => 'joinSpaceItemView'));

    if ($screen->isAjaxLinkClicked($searchStr)) {
        //$screen->renderView('joinSpaceItemView');
        $control1 = new BUIThemedControl('joinSpaceList');
        $control1->addRenderView('joinSpaceList');
        $control1->render();
    }
    ?>
</div>